/**
 * debug.js, only used to debug app, will not included in release edtion.
 */

function createDemoDb() {
    var dbs = [];
    var db1 = new DataSource("http://ccnt.zju.edu.cn/dart/demo/db1");
    var table1 = new Table(db1.uri + ".student", "student", statistic.table++);
    var col1 = new Column(table1.uri + ".id", "id");
    var col2 = new Column(table1.uri + ".name", "name");
    table1.addColumn(col1);
    table1.addColumn(col2);
    db1.addTable(table1);
    var table2 = new Table(db1.uri + ".course", "course", statistic.table++);
    var col3 = new Column(table2.uri + ".couseId", "courseId");
    var col4 = new Column(table2.uri + ".name", "name");
    table2.addColumn(col3);
    table2.addColumn(col4);
    db1.addTable(table2);
    var table3 = new Table(db1.uri + ".choose", "choose", statistic.table++);
    var col5 = new Column(table3.uri + ".studentId", "studentId");
    var col6 = new Column(table3.uri + ".courseId", "courseId");
    table3.addColumn(col5);
    table3.addColumn(col6);
    db1.addTable(table3);
    dbs.push(db1);
    var db2 = new DataSource("http://ccnt.zju.edu.cn/dart/demo/db2");
    var table4 = new Table(db2.uri + ".student1", "student1", statistic.table++);
    var col7 = new Column(table4.uri + ".studentId", "studentId");
    var col8 = new Column(table4.uri + ".age", "age");
    table4.addColumn(col7);
    table4.addColumn(col8);
    db2.addTable(table4);
    var table5 = new Table(db2.uri + ".friend", "friend", statistic.table++);
    var col9 = new Column(table5.uri + ".id", "id");
    var col10 = new Column(table5.uri + ".fid", "fid");
    table5.addColumn(col9);
    table5.addColumn(col10);
    statistic.column = 10;
    db2.addTable(table5);
    dbs.push(db2);
    globalVar.dbView.addDb(dbs);
}

function createDemoOnto() {
    var ontos = [];
    var onto1 = new Ontology("http://ccnt.zju.edu.cn/dart/demo#student", "student");
    var child1 = new Property("http://ccnt.zju.edu.cn/dart/demo#id", "id");
    var child2 = new Property("http://ccnt.zju.edu.cn/dart/demo#name", "name");
    var child5 = new Property("http://ccnt.zju.edu.cn/dart/demo#choose", "choose");
    child5.isValue = false;
    child5.object = "http://ccnt.zju.edu.cn/dart/demo#course";
    onto1.addProperty(child1);
    onto1.addProperty(child2);
    onto1.addProperty(child5);
    ontos.push(onto1);
    var onto2 = new Ontology("http://ccnt.zju.edu.cn/dart/demo#course", "course");
    var child3 = new Property("http://ccnt.zju.edu.cn/dart/demo#courseId", "couseId");
    var child4 = new Property("http://ccnt.zju.edu.cn/dart/demo#name", "name");
    onto2.addProperty(child3);
    onto2.addProperty(child4);
    ontos.push(onto2);
    statistic.ontology = 2;
    statistic.property = 4;
    globalVar.ontoView.addOnto(ontos);
}
